/**
 * 
 */
package com.design.patterns.etat;

import java.util.ArrayList;
import java.util.List;

/**
 * @author fred
 * 
 */
public class Banque {
	private String nom;
	private List<Agence> agences;
	private Etat etat;

	/**
	 * @return the nom
	 */
	public String getNom() {
		return nom;
	}

	/**
	 * @param nom
	 *            the nom to set
	 */
	public void setNom(String nom) {
		this.nom = nom;
	}

	/**
	 * @return the agences
	 */
	public List<Agence> getAgences() {
		return agences;
	}

	/**
	 * @param agences
	 *            the agences to set
	 */
	public void setAgences(List<Agence> agences) {
		this.agences = agences;
	}

	/**
	 * @return the etat
	 */
	public Etat getEtat() {
		return etat;
	}

	/**
	 * @param etat
	 *            the etat to set
	 */
	public void setEtat(Etat etat) {
		this.etat = etat;
	}

	public Banque(String nom) {
		this.nom = nom;
		etat = new EtatInitial(this);
		agences = new ArrayList<Agence>();
	}

	public void validate() {
		etat.validate();
	}

	public void addAgence(Agence agence) {
		etat.addAgence(agence);
	}

	public void delAgence(Agence agence) {
		etat.delAgence(agence);
	}

	public void delete() {
		etat.delete();
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Banque [nom=" + nom + ", agences=" + agences + "]";
	}
}
